//
//  OCNodeInfo.m
//  RoutingEvaluator
//
//  Created by Christopher Kemsley on 4/15/12.
//  Copyright (c) 2012 iAppolopolis. All rights reserved.
//

#import "OCNodeInfo.h"

@implementation OCNodeInfo {
	Sim::NodeInfo	*	info ;
}
@synthesize info ;
@dynamic identifier , location ;


- (id)	initWithNodeInfo:(Sim::NodeInfo*)i {
	if ( (self = [super init]) )
		{
		info = i ;
		}
	return self ;
}

- (Sim::Float64)	distanceToNode:(OCNodeInfo*)node {
	return info -> distanceFromNode ( node.info ) ;
}


- (CGPoint)	location {
	CGPoint pt = { info->location.dX , info->location.dY } ;
	return pt ;
}
- (Sim::Identifier)	identifier {
	return info->identifier ;
}


- (NSUInteger) hash {
	return (NSUInteger)info ;
}
- (BOOL)	isEqual:(id)object {
	if ( [object isKindOfClass:[OCNodeInfo class]] )
		{
		OCNodeInfo * node = object ;
		return info == [node info] ;
		}
	return NO ;
}
- (NSString*)	description {
	return [ [super description] stringByAppendingFormat:@" { underlying: 0x%08lX , identifier: %u , location: %@ }",(unsigned long)info,self.identifier,NSStringFromPoint(self.location) ] ;
}

@end
